package com.escope.casemanager.controller;

import com.escope.casemanager.model.CaseExample;
import com.escope.casemanager.model.CaseShare;
import com.escope.casemanager.model.HttpResult;
import com.escope.casemanager.service.CaseShareService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 案例分享管理接口
 * 2024/3/15
 */
@RestController
@RequestMapping("shareManager")
@CrossOrigin
@Api(value = "案例分享接口", tags = {"案例分享接口"})
public class CaseShareController {
    @Autowired
    private CaseShareService caseShareService;

    @GetMapping(value = "/findByExamId")
    @ApiOperation("根据案例ID查询分享信息")
    public HttpResult findByExamId(Long examId) {
        return caseShareService.findByExamId(examId);
    }

    @PostMapping(value = "/save")
    @ApiOperation("创建或修改案例分享")
    public HttpResult save(CaseShare share) {
        return caseShareService.saveOrUpdate(share);
    }

    @PostMapping(value = "/delete")
    @ApiOperation("删除案例信息")
    public HttpResult delete(Long id) {
        return caseShareService.delete(id);
    }


}
